<?php
global $Silas;?>

<?php if ($error):?>
<div id="message" class="error fade"><p><strong><?php echo $error?></strong></p></div>
<?php elseif ($message):?>
<div id="message" class="updated fade"><p><strong><?php echo $message?></strong></p></div>
<?php endif;?>

<style>
fieldset.options {
    clear:both;
    border:1px solid #ccc;
}
fieldset.options legend {
    font-family: Georgia,"Times New Roman",Times,serif;
    font-size: 22px;
}

div.album {
    float:left;
    width:200px;
    height:150px;
    margin-right:15px;
}
div.album td {
    font-size:0.9em;
}
div.album-hidden img {
    opacity:0.5;
}
</style>


<div class="wrap">
<h2 id="write-post">Photo Album Configuration</h2>
<p>
This plugin will retrieve your Flickr photosets and display them as albums on a page within this site. 
This plugin will also allow you to easily add your photos to your blog posts (or pages). 
</p>
<p><strong>Installation and Usage:</strong> Just follow the onscreen prompts to link your photo album to a Flickr account. 
To insert photos into your posts, just click the <em>Photos</em> tab in the edit screen and then click on a thumbnail. </p>

<p><em>Important:</em> After you have updated or created a new Flickr set, visit this page to update your photo album's cache with your latest photos.
If you are logged in as an administrator, then you should also see a "refresh photos" button in the top right corner of your photo album which does the same thing.
</p>

<?php if (!is_object($Silas)):?>

<div  style="float:right;width:250px;background:#eee;padding:10px;font-size:0.9em;">
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
If you find this plugin helpful, please consider donating a few dollars to support this plugin. Thanks!
<br /><br />
<input type="hidden" name="cmd" value="_s-xclick">
<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but04.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHRwYJKoZIhvcNAQcEoIIHODCCBzQCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDA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FF8jermCkGcvoxLmOQOOXpKH9VPHj3a56SP8xS27lzbDvZ8TPFvcv0Afd7gGtjWYG1QkuKqs78ARtzIbSPuVngCqriAq4rZteJjWvMh4NIoL4qzXiOXdw5VId+QLUf0yVy2KLGIbw==-----END PKCS7-----">

</form>
</div>


<p>
This plugin is provided by <a href="http://www.silaspartners.com">Silas Partners</a> 
and licensed free of charge for you to use under the GPL.
This plugin is <em>unsupported</em> and comes with no official technical support. Please do not contact Silas Partners for support for this plugin.
</p>
<p>
However, you can check the following pages for the latest updates to this plugin, 
along with any unofficial technical support:<br>
<br>
<strong>Releases:</strong> <a href="http://tantannoodles.com/toolkit/photo-album/">tantannoodles.com/toolkit/photo-album/</a><br>
<strong>Support Group:</strong> <a href="http://www.flickr.com/groups/tantannoodles/">flickr.com/groups/tantannoodles</a>
</p>
<p>
<strong>RSS Updates:</strong> Subscribe to the <a href="http://feeds.feedburner.com/TanTanToolkit">TanTanToolkit feed</a> and get notified when there's an update to this plugin.
</p>
<?php endif;?>

<?php 
if (!$flickr_apikey || !$flickr_sharedsecret) { // no api key
    include(dirname(__FILE__).'/admin-options-apikey.html');
}elseif (!$flickrAuth) { // authenticate
    include(dirname(__FILE__).'/admin-options-auth.html');
} else { // general flickr settings
    include(dirname(__FILE__).'/admin-options-flickrsettings.html');
    ?>
    <fieldset class="options">
    <legend>Photo Albums</legend>
    
    <form method="post">
    <input type="hidden" name="action" value="clearcache" />
    <input type="hidden" name="album" value="all" />
    
    <input type="button" value="Organize Albums" onclick="window.open('http://www.flickr.com/photos/organize/?start_tab=sets', '_blank');return false" />
    <input type="submit" value="Refresh All Albums" /><br>
    <small>Your Flickr albums will be cached locally to help speed things up. Click <strong>refresh</strong> to synchronize and refresh all your albums.</small>
    </form>
    
    <hr />
    <form method="post">
    <input type="hidden" name="action" value="savealbumsettings" />
    <div id="options-albums">Please wait. Now loading your albums...</div>
    <p class="submit" style="clear:both;"><input type="submit" value="save settings &gt;" /></p>
    </form>
   
    </fieldset>
    
    <fieldset class="options">
    <legend>Group Photos</legend>
    <form method="post">
    <input type="hidden" name="action" value="cleargroupcache" />
    <input type="hidden" name="group" value="all" />
    
    <input type="button" value="Organize Groups" onclick="window.open('http://flickr.com/photos/organize/?start_tab=groups', '_blank');return false;" />
    <input type="submit" value="Refresh All Groups" /><br>
    <small>Your Flickr groups will be cached locally to help speed things up.
    Click <strong>refresh</strong> to synchronize and refresh all your groups.</small>
    <hr />
    </form>
    
    <form method="post">
    <input type="hidden" name="action" value="savegroupsettings" />

    <div id="options-groups">Please wait. Now loading your groups...</div>
    
    <a href="#" onclick="return hideAllGroups()">toggle group hiding</a>
    <p class="submit" style="clear:both;">
    <input type="submit" value="save settings &gt;" />
    </p>
    <script>
    function hideAllGroups() {
        var inputs = document.getElementsByTagName('input')
        for (var i=0; i<inputs.length; i++) {
            if (inputs[i].name == 'hideGroup[]') {
                inputs[i].checked = !inputs[i].checked
            }
        }
        return false
    }
    </script>
    </form>
    
    </fieldset>
    
    <script type="text/javascript" src="../wp-includes/js/tw-sack.js"></script>
    <script>
    function getOptions(what) {
        var ajaxUpdate = new sack();
        ajaxUpdate._silas_what = what
        ajaxUpdate.requestFile = "../wp-content/plugins/silaspartners/flickr/admin-options-load.php"
        ajaxUpdate.method = 'GET';
        ajaxUpdate.onLoading = function() {}
        ajaxUpdate.onLoaded = function() {}
        ajaxUpdate.onInteractive = function() {}
        ajaxUpdate.onCompletion = function() {
            var options = document.getElementById('options-'+this._silas_what);
            options.innerHTML = this.response
        }
        ajaxUpdate.runAJAX('view='+what);
    }
    getOptions('albums');
    getOptions('groups');
    
    
    </script>
            	    
    <?php
} //flickr auth
?>



</div>